<style>
label.error {
	color: red;
	float: none;
	padding-left: 0.5em;
	vertical-align: middle;
	}</style>

<script>
$(document).ready(function(){
	$("#UserRegisterForm").validate({});
	});
</script>
<div id="registerpanel" style="margin-left:auto;margin-right:auto;width:600px;padding-top: 100px;">
<div class="opaque">
<fieldset class="ui-widget ui-widget-content ui-corner-all">
<legend><?php __('Signup');?></legend>
<?php
echo $this->Session->flash();
echo $form->create('User', array('action' => 'register' ) );
echo $form->input('username', array('after'=>'<div id="usernameresult" style="display:inline"></div><br/>','div'=>FALSE,'label' => __('Login Name :',true),'class'=>'required'));
echo $form->input('fullname', array('after'=>'<br/>','div'=>FALSE,'label' => __('Full name :',true),'class'=>'required') );
echo $form->input('email', array('after'=>'<br/>','div'=>FALSE,'label' => __('Email :',true),'class'=>'required email') );
echo $form->input('password', array('minlength'=>'8','after'=>'<br/>','div'=>FALSE,'label' => __('Password :',true), 'type' => 'password','class'=>'required'));
if ($form->isFieldError('password')) {
		echo '<br/><strong>'.$form->error('username').'</strong>';
	}
echo $form->input('password_confirm', array('after'=>'<br/>','div'=>FALSE,'label' => __('Retype Password :',true), 'type' => 'password','equalTo'=>'#UserPassword'));
echo $form->input('security_code', array('after'=>'<br/>','div'=>FALSE,'label' => __('Please Enter the Sum of ',true) . $mathCaptcha,'class'=>'required'));
echo "<br/>";
echo "<center>".$form->button('<span class="ui-button-text">'.__('Register',true).'</span>',array('onclick'=>'return $(\'#UserRegisterForm\').validate().form();','div'=>false,'type'=>'submit','class'=>'submit ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only'))."</center>";
echo $form->end();
?>
</fieldset>
</div>
</div>
<?php 
$this->Js->get('#UserUsername');
$this->Js->event('focusout',
$this->Js->request(
array('controller' => 'users','action'=>'check_username'),
array(
'type'=>'json',
'method'=>'post',
'update'=>'#usernameresult',
'data'=> '{data:$("#UserUsername").val()}',
'dataExpression' => true,
'error'=>'alert("An unexpected error has occurred!");'							
	)));

echo $this->Js->writeBuffer();
?>